package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.JobWaitDayExamineAccount;
import com.ruoyi.system.mapper.JobWaitDayExamineAccountMapper;
import com.ruoyi.system.service.JobWaitDayExamineAccountService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 日审核表汇总台账(JobWaitDayExamineAccount)表服务实现类
 *
 * @author makejava
 * @since 2022-11-23 09:20:10
 */
@Service("jobWaitDayExamineAccountService")
public class JobWaitDayExamineAccountServiceImpl implements JobWaitDayExamineAccountService {
    @Resource
    private JobWaitDayExamineAccountMapper jobWaitDayExamineAccountDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public JobWaitDayExamineAccount queryById(Integer id) {
        return this.jobWaitDayExamineAccountDao.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param jobWaitDayExamineAccount 筛选条件
     * @param pageRequest      分页对象
     * @return 查询结果
     */
    @Override
    public Page<JobWaitDayExamineAccount> queryByPage(JobWaitDayExamineAccount jobWaitDayExamineAccount, PageRequest pageRequest) {
        long total = this.jobWaitDayExamineAccountDao.count(jobWaitDayExamineAccount);
        return new PageImpl<>(this.jobWaitDayExamineAccountDao.queryAllByLimit(jobWaitDayExamineAccount, pageRequest), pageRequest, total);
    }

    @Override
    public List<JobWaitDayExamineAccount> queryAll(JobWaitDayExamineAccount jobWaitDayExamineAccount) {
        return jobWaitDayExamineAccountDao.queryAll(jobWaitDayExamineAccount);
    }

    /**
     * 新增数据
     *
     * @param jobWaitDayExamineAccount 实例对象
     * @return 实例对象
     */
    @Override
    public JobWaitDayExamineAccount insert(JobWaitDayExamineAccount jobWaitDayExamineAccount) {
        this.jobWaitDayExamineAccountDao.insert(jobWaitDayExamineAccount);
        return jobWaitDayExamineAccount;
    }

    /**
     * 修改数据
     *
     * @param jobWaitDayExamineAccount 实例对象
     * @return 实例对象
     */
    @Override
    public JobWaitDayExamineAccount update(JobWaitDayExamineAccount jobWaitDayExamineAccount) {
        this.jobWaitDayExamineAccountDao.update(jobWaitDayExamineAccount);
        return this.queryById(jobWaitDayExamineAccount.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.jobWaitDayExamineAccountDao.deleteById(id) > 0;
    }
}
